package com.unisound.tracelog.client.core.properties;

import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "tracelog.client")
public class TraceLogClientProperties {

    /**
     * 服务名称
     */
    private String defaultServerName;

    /**
     * 总开关
     */
    private boolean enable = true;

    /**
     * 日志开关
     */
    private boolean logEnable = true;

    /**
     * 上报开关
     */
    private boolean reportEnable = false;

    private String kafkaTopicSpan;
    private String kafkaTopicTag;



    private int poolMinThreadNumber = 10;
    private int poolMaxThreadNumber = 10;
    private int poolQueueSize = 500;

    private SQL sql = new SQL();

    public SQL getSql() {
        return sql;
    }

    public void setSql(SQL sql) {
        this.sql = sql;
    }

    public String getDefaultServerName() {
        return defaultServerName;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setDefaultServerName(String defaultServerName) {
        this.defaultServerName = StringUtils.trimToNull(defaultServerName);
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getKafkaTopicSpan() {
        return kafkaTopicSpan;
    }

    public void setKafkaTopicSpan(String kafkaTopicSpan) {
        this.kafkaTopicSpan = StringUtils.trimToNull(kafkaTopicSpan);
    }

    public String getKafkaTopicTag() {
        return kafkaTopicTag;
    }

    public void setKafkaTopicTag(String kafkaTopicTag) {
        this.kafkaTopicTag = StringUtils.trimToNull(kafkaTopicTag);
    }

    public boolean isLogEnable() {
        return logEnable;
    }

    public void setLogEnable(boolean logEnable) {
        this.logEnable = logEnable;
    }

    public int getPoolMinThreadNumber() {
        return poolMinThreadNumber;
    }

    public void setPoolMinThreadNumber(int poolMinThreadNumber) {
        this.poolMinThreadNumber = poolMinThreadNumber;
    }

    public int getPoolMaxThreadNumber() {
        return poolMaxThreadNumber;
    }

    public void setPoolMaxThreadNumber(int poolMaxThreadNumber) {
        this.poolMaxThreadNumber = poolMaxThreadNumber;
    }

    public int getPoolQueueSize() {
        return poolQueueSize;
    }

    public void setPoolQueueSize(int poolQueueSize) {
        this.poolQueueSize = poolQueueSize;
    }

    public boolean isReportEnable() {
        return reportEnable;
    }

    public void setReportEnable(boolean reportEnable) {
        this.reportEnable = reportEnable;
    }

    public static class SQL {
        private boolean enabled = false;

        public boolean isEnabled() {
            return enabled;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }
    }

}
